import { IPSSysEAIDE } from './ipssys-eaide';
import { IPSSysEAIDataType } from './ipssys-eaidata-type';
import { IPSSysEAIElement } from './ipssys-eaielement';
import { IPSSysEAIScheme } from './ipssys-eaischeme';
import { IPSSysSFPlugin } from '../res/ipssys-sfplugin';
import { IPSSystemModule } from '../system/ipssystem-module';
import { PSModelObjectImpl } from '../psmodel-object-impl';

export class PSSysEAISchemeImpl extends PSModelObjectImpl implements IPSSysEAIScheme {
  protected allpssyseaides: IPSSysEAIDE[] | null = null;

  getAllPSSysEAIDEs(): IPSSysEAIDE[] | null {
    if (this.allpssyseaides == null) {
      this.allpssyseaides = this.fillChildListModel(this.M.getAllPSSysEAIDEs, 'eai.IPSSysEAIDE') as IPSSysEAIDE[];
    }
    return this.allpssyseaides;
  }

  get allPSSysEAIDEs(): IPSSysEAIDE[] | null {
    return this.getAllPSSysEAIDEs();
  }

  findPSSysEAIDE(objKey: any): IPSSysEAIDE | null {
    return this.getPSModel5('eai.IPSSysEAIDE', this.getAllPSSysEAIDEs(), objKey) as IPSSysEAIDE;
  }

  protected allpssyseaidatatypes: IPSSysEAIDataType[] | null = null;

  getAllPSSysEAIDataTypes(): IPSSysEAIDataType[] | null {
    if (this.allpssyseaidatatypes == null) {
      this.allpssyseaidatatypes = this.fillChildListModel(this.M.getAllPSSysEAIDataTypes, 'eai.IPSSysEAIDataType') as IPSSysEAIDataType[];
    }
    return this.allpssyseaidatatypes;
  }

  get allPSSysEAIDataTypes(): IPSSysEAIDataType[] | null {
    return this.getAllPSSysEAIDataTypes();
  }

  findPSSysEAIDataType(objKey: any): IPSSysEAIDataType | null {
    return this.getPSModel5('eai.IPSSysEAIDataType', this.getAllPSSysEAIDataTypes(), objKey) as IPSSysEAIDataType;
  }

  protected allpssyseaielements: IPSSysEAIElement[] | null = null;

  getAllPSSysEAIElements(): IPSSysEAIElement[] | null {
    if (this.allpssyseaielements == null) {
      this.allpssyseaielements = this.fillChildListModel(this.M.getAllPSSysEAIElements, 'eai.IPSSysEAIElement') as IPSSysEAIElement[];
    }
    return this.allpssyseaielements;
  }

  get allPSSysEAIElements(): IPSSysEAIElement[] | null {
    return this.getAllPSSysEAIElements();
  }

  findPSSysEAIElement(objKey: any): IPSSysEAIElement | null {
    return this.getPSModel5('eai.IPSSysEAIElement', this.getAllPSSysEAIElements(), objKey) as IPSSysEAIElement;
  }

  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected pssyssfplugin: IPSSysSFPlugin | null = null;

  getPSSysSFPlugin(): IPSSysSFPlugin | null {
    if (this.pssyssfplugin != null) return this.pssyssfplugin;
    const value = this.M.getPSSysSFPlugin;
    if (value == null) {
      return null;
    }
    this.pssyssfplugin = this.getPSModel4('res.IPSSysSFPlugin', value, 'getPSSysSFPlugin') as IPSSysSFPlugin;
    return this.pssyssfplugin;
  }

  get psSysSFPlugin(): IPSSysSFPlugin | null {
    return this.getPSSysSFPlugin();
  }

  getPSSysSFPluginMust(): IPSSysSFPlugin {
    const value = this.getPSSysSFPlugin();
    if (value == null) {
      throw new Error('未指定后台扩展插件');
    }
    return value;
  }

  protected pssystemmodule: IPSSystemModule | null = null;

  getPSSystemModule(): IPSSystemModule | null {
    if (this.pssystemmodule != null) return this.pssystemmodule;
    const value = this.M.getPSSystemModule;
    if (value == null) {
      return null;
    }
    this.pssystemmodule = this.getPSModel4('system.IPSSystemModule', value, 'getPSSystemModule') as IPSSystemModule;
    return this.pssystemmodule;
  }

  get psSystemModule(): IPSSystemModule | null {
    return this.getPSSystemModule();
  }

  getPSSystemModuleMust(): IPSSystemModule {
    const value = this.getPSSystemModule();
    if (value == null) {
      throw new Error('未指定系统模块');
    }
    return value;
  }

  get schemeTag(): string {
    return this.M.schemeTag;
  }

  get schemeTag2(): string {
    return this.M.schemeTag2;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get cls(): string {
    return 'PSSysEAISchemeImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'IPSModelObject' || cls == 'IPSObject' || cls == 'eai.IPSEAIScheme' || cls == 'eai.IPSSysEAIScheme') return true;
    return super.instanceof(cls);
  }
}
